package com.hencoder.hencoderpracticedraw1.practice;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

public class Practice11PieChartView extends View {

    public Practice11PieChartView(Context context) {
        super(context);
    }

    public Practice11PieChartView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public Practice11PieChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);


//        综合练习
//        练习内容：使用各种 Canvas.drawXXX() 方法画饼图


        RectF rectF =new RectF(50,50,200,200);

        paint.setColor(Color.YELLOW);
        canvas.drawArc(rectF,0,-60,true,paint);

        paint.setStrokeWidth(1);

        canvas.drawLine(200,95,220,85,paint);


        canvas.drawLine(220,85,240,85,paint);

        paint.setTextSize(14);

        canvas.drawText("Frist",250,90,paint);

        RectF rectF1 =new RectF(50,50,200,200);

        paint.setColor(Color.YELLOW);
        canvas.drawArc(rectF1,5,25,true,paint);

        paint.setStrokeWidth(1);

        canvas.drawLine(220,110,260,110,paint);




        paint.setTextSize(14);

        canvas.drawText("Frist",250,110,paint);

    }
}
